<script lang="ts" setup>
import * as ElIcon from "@element-plus/icons-vue"
const emit = defineEmits(["getIcon"])
function handleClipboard(name: string | undefined): void {
  emit("getIcon", name)
  //return name
}
</script>
<template>
  <div class="icons-container">
    <div class="grid">
      <div
        v-for="(item, key) of ElIcon"
        :key="key"
        @click="handleClipboard(item.name)"
        style="justify-content: center; display: flex"
      >
        <el-tooltip placement="top" :content="item.name">
          <div class="icon-item">
            <component :is="item" style="width: 35px; height: 35px" />
          </div>
        </el-tooltip>
      </div>
    </div>
  </div>
</template>

<style scoped>
.icons-container {
  margin: 10px 20px 0;
  overflow: auto;
  .grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .icon-item {
    margin: 20px;
    height: 40px;
    text-align: center;
    width: 40px;
    float: left;
    font-size: 30px;
    color: #24292e;
    cursor: pointer;
  }

  span {
    display: block;
    font-size: 16px;
    margin-top: 10px;
  }

  .disabled {
    pointer-events: none;
  }
}
</style>
